package com.niit.apis;

import com.niit.entity.Notification;
import jakarta.servlet.http.HttpSession;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.data.domain.Page;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name = "notification-service")
public interface NotificationFeignApi {
	@GetMapping("/api/notification/findAll")
	Page<Notification> findNotifications(
			@RequestParam(required = false) String title,
			@RequestParam(required = false) Byte level,
			@RequestParam(required = false) Byte type,
			@RequestParam(defaultValue = "1") Integer page,
			@RequestParam(defaultValue = "10") Integer size,
			@RequestParam(defaultValue = "1") Integer loginType);

	@GetMapping("/api/notification/view/{id}")
	Notification getNotificationView(@PathVariable Integer id);

	@PostMapping("/api/notification")
	void createNotification(@RequestBody Notification notification);

	@PutMapping("/api/notification/{id}")
	void updateNotification(@PathVariable Integer id, @RequestBody Notification notification);

	@DeleteMapping("/api/notification/{id}")
	void deleteNotification(@PathVariable Integer id);

	@DeleteMapping("/api/notification/batch")
	void deleteNotifications(@RequestBody List<Integer> ids);

	@PostMapping("/api/notification/read/{notificationId}")
	void markAsRead(@PathVariable Integer notificationId,@RequestParam Integer userId);
}
